package spbgpu.ftf.av.ball;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;

public class DrawingRegion extends Canvas {
    
	private Oval oval = new Oval(300, 300, 20);
	private static final long serialVersionUID = 1L;
    int t=1;
    int b=1;
	public DrawingRegion(int width, int height) {
		setSize(width,height);
		setBackground(Color.LIGHT_GRAY);
	}
	
	@Override
	public void paint(Graphics g) {
		System.out.println("painting"+oval.getY());
        if (((oval.getY()+oval.getRad1())>=500)||((oval.getY())<=0)) t=t*(-1);
        if (((oval.getX()+oval.getRad1())>=700)||((oval.getX())<=0)) b=b*(-1);
		oval.setY(oval.getY()+t*10);
		oval.setX(oval.getX()+b*10);
		oval.paintMs(g);
	
		
	}
	
	
	
}
